﻿using System;
using System.Data;
using System.Collections.Generic;
using eTMS.Controllers.TieuChiXetDuyetService;
namespace eTMS.Controllers{
public class TieuChiXetDuyetControllerBase : CommonController{
	public TieuChiXetDuyetControllerBase()
		: base()
	{	
		this.dao = new TieuChiXetDuyetServiceClient();
	}
	protected TieuChiXetDuyetServiceClient dao;
	~TieuChiXetDuyetControllerBase(){
		try{dao.Close();}catch{}
	}
    //Copy data from data row in grid to object
    public TieuChiXetDuyetEntity MapDataRowToObject(DataRow row){
		TieuChiXetDuyetEntity o = new TieuChiXetDuyetEntity();
		 o.TenTieuChiXetDuyet=Convert.ToString(row["TenTieuChiXetDuyet"]);
		 if(!row.IsNull("LoaiXetDuyet"))
			o.LoaiXetDuyet=ConvertByte(row["LoaiXetDuyet"]);
		 o.GhiChu=Convert.ToString(row["GhiChu"]);
		 o.NoiDung=Convert.ToString(row["NoiDung"]);
		 if(!row.IsNull("TieuChiXetDuyet_ID"))
		    o.TieuChiXetDuyet_ID=(Int32)(row["TieuChiXetDuyet_ID"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(TieuChiXetDuyetEntity o,DataRow row){
		row["TenTieuChiXetDuyet"]=o.TenTieuChiXetDuyet;
		row["LoaiXetDuyet"]=o.LoaiXetDuyet;
		row["GhiChu"]=o.GhiChu;
		row["NoiDung"]=o.NoiDung;
		row["TieuChiXetDuyet_ID"]=o.TieuChiXetDuyet_ID;
    }
}
}
